package com.iteaj.iot.client.component;

import com.iteaj.iot.client.UdpSocketClient;
import com.iteaj.iot.client.ClientMessage;
import com.iteaj.iot.client.MultiClientManager;
import com.iteaj.iot.config.ConnectProperties;

/**
 * 基于udp实现的客户端
 */
public abstract class UdpClientComponent<M extends ClientMessage> extends SocketClientComponent<M> {

    public UdpClientComponent(ConnectProperties config) {
        super(config);
    }

    public UdpClientComponent(ConnectProperties config, MultiClientManager clientManager) {
        super(config, clientManager);
    }

    @Override
    public void init(Object ...args) {
        this.getClient().init(args[0]);
    }

    public abstract UdpSocketClient createNewClient(ConnectProperties config);

    /**
     * 短线重连时间间隔(秒)
     * @return 0 udp不需要重连功能
     */
    public long getReconnectTime() {
        return 0;
    }

}
